import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

class BottomSheetPage extends StatelessWidget {
  const BottomSheetPage({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text("BottomSheetPage"),
      ),
      body: Center(
        child: TextButton(
          onPressed: () {
            showModalBottomSheet(
                context: context,
                builder: (BuildContext context) {
                  return _createBottomContent(context);
                });
          },
          child: const Text("showBottomSheet"),
        ),
      ),
    );
  }

  _createBottomContent(BuildContext context) {
    return Container(
      height: 300,
      color: Colors.greenAccent,
      child: Center(
        child: TextButton(
          onPressed: () {
            Navigator.pop(context);
          },
          child: const Text(
            "hideBottomSheet",
            style: TextStyle(color: Colors.white),
          ),
        ),
      ),
    );
  }
}
